/*
 * CustomColorPalette.java  0.4.0 / Oct 25, 2010
 *
 * Copyright (c) 2010 - 2011, cute4j.com and contributors.
 *
 * This software is licensed under the LGPL version 2.1 license.
 * A copy of this license is included in the file LICENSE-LGPL.txt.
 */
package com.cute4j.swing.styles; // NOPMD

import com.cute4j.swing.Swing;
import com.cute4j.swing.graphics.Color;

/**
 * Custom Color Palette.
 *
 * @cute4j.native
 *    generate="header"
 *
 * @author Slobodan Vrkacevic
 * @version 0.4.0
 */
public class CustomColorPalette extends ColorPalette { // NOPMD

// Static Initialization. ------------------------------------------------------

  static {
    Swing.initialize();
  }

// Private Fields. -------------------------------------------------------------

  private int hashCode; // NOPMD

// Protected Fields. -----------------------------------------------------------

  protected String name;
  protected Color activeBackgroundColor;
  protected Color inactiveBackgroundColor;
  protected Color disabledBackgroundColor;
  protected Color activeForegroundColor;
  protected Color inactiveForegroundColor;
  protected Color disabledForegroundColor;
  protected Color activeBaseColor;
  protected Color inactiveBaseColor;
  protected Color disabledBaseColor;
  protected Color activeAlternateBaseColor;
  protected Color inactiveAlternateBaseColor;
  protected Color disabledAlternateBaseColor;
  protected Color activeTextColor;
  protected Color inactiveTextColor;
  protected Color disabledTextColor;
  protected Color activeButtonColor;
  protected Color inactiveButtonColor;
  protected Color disabledButtonColor;
  protected Color activeButtonTextColor;
  protected Color inactiveButtonTextColor;
  protected Color disabledButtonTextColor;
  protected Color activeBrightTextColor;
  protected Color inactiveBrightTextColor;
  protected Color disabledBrightTextColor;
  protected Color activeLightColor;
  protected Color inactiveLightColor;
  protected Color disabledLightColor;
  protected Color activeMidlightColor;
  protected Color inactiveMidlightColor;
  protected Color disabledMidlightColor;
  protected Color activeDarkColor;
  protected Color inactiveDarkColor;
  protected Color disabledDarkColor;
  protected Color activeMidColor;
  protected Color inactiveMidColor;
  protected Color disabledMidColor;
  protected Color activeShadowColor;
  protected Color inactiveShadowColor;
  protected Color disabledShadowColor;
  protected Color activeHighlightColor;
  protected Color inactiveHighlightColor;
  protected Color disabledHighlightColor;
  protected Color activeHighlightedTextColor;
  protected Color inactiveHighlightedTextColor;
  protected Color disabledHighlightedTextColor;
  protected Color activeLinkColor;
  protected Color inactiveLinkColor;
  protected Color disabledLinkColor;
  protected Color activeLinkVisitedColor;
  protected Color inactiveLinkVisitedColor;
  protected Color disabledLinkVisitedColor;

// Public Constructors. --------------------------------------------------------

  /**
   * Constructs new CustomColorPalette object.
   */
  public CustomColorPalette() {
    // empty implementation
  }

  /**
   * Constructs new CustomColorPalette object.
   *
   * @param name the name
   */
  public CustomColorPalette(String name) {
    this.name = name;
    _fillPalette(name); // NOPMD
  }

  /**
   * Constructs new CustomColorPalette object using the specified background
   * color.
   *
   * @param backgroundColor the background color
   */
  public CustomColorPalette(Color backgroundColor) {
    if (backgroundColor == null) {
      throw new IllegalArgumentException("Null background color");
    }
    _fillPaletteFromColor(backgroundColor.getARGB()); // NOPMD
  }

// Public Methods. -------------------------------------------------------------

  /**
   * Sets active background color.
   *
   * @param activeBackgroundColor the active background color
   */
  public void setActiveBackgroundColor(Color activeBackgroundColor) {
    this.activeBackgroundColor = activeBackgroundColor;
    hashCode = 0;
  }

  /**
   * Sets inactive background color.
   *
   * @param inactiveBackgroundColor the inactive background color
   */
  public void setInactiveBackgroundColor(Color inactiveBackgroundColor) {
    this.inactiveBackgroundColor = inactiveBackgroundColor;
    hashCode = 0;
  }

  /**
   * Sets disabled background color.
   *
   * @param disabledBackgroundColor the disabled background color
   */
  public void setDisabledBackgroundColor(Color disabledBackgroundColor) {
    this.disabledBackgroundColor = disabledBackgroundColor;
    hashCode = 0;
  }

  /**
   * Sets active foreground color.
   *
   * @param activeForegroundColor the active foreground color
   */
  public void setActiveForegroundColor(Color activeForegroundColor) {
    this.activeForegroundColor = activeForegroundColor;
    hashCode = 0;
  }

  /**
   * Sets inactive foreground color.
   *
   * @param inactiveForegroundColor the inactive foreground color
   */
  public void setInactiveForegroundColor(Color inactiveForegroundColor) {
    this.inactiveForegroundColor = inactiveForegroundColor;
    hashCode = 0;
  }

  /**
   * Sets disabled foreground color.
   *
   * @param disabledForegroundColor the disabled foreground color
   */
  public void setDisabledForegroundColor(Color disabledForegroundColor) {
    this.disabledForegroundColor = disabledForegroundColor;
    hashCode = 0;
  }

  /**
   * Sets active base color.
   *
   * @param activeBaseColor the active base color
   */
  public void setActiveBaseColor(Color activeBaseColor) {
    this.activeBaseColor = activeBaseColor;
    hashCode = 0;
  }

  /**
   * Sets inactive base color.
   *
   * @param inactiveBaseColor the inactive base color
   */
  public void setInactiveBaseColor(Color inactiveBaseColor) {
    this.inactiveBaseColor = inactiveBaseColor;
    hashCode = 0;
  }

  /**
   * Sets disabled base color.
   *
   * @param disabledBaseColor the disabled base color
   */
  public void setDisabledBaseColor(Color disabledBaseColor) {
    this.disabledBaseColor = disabledBaseColor;
    hashCode = 0;
  }

  /**
   * Sets active alternate color.
   *
   * @param activeAlternateBaseColor the active alternate color
   */
  public void setActiveAlternateBaseColor(Color activeAlternateBaseColor) {
    this.activeAlternateBaseColor = activeAlternateBaseColor;
    hashCode = 0;
  }

  /**
   * Sets inactive alternate color.
   *
   * @param inactiveAlternateBaseColor the inactive alternate color
   */
  public void setInactiveAlternateBaseColor(Color inactiveAlternateBaseColor) {
    this.inactiveAlternateBaseColor = inactiveAlternateBaseColor;
    hashCode = 0;
  }

  /**
   * Sets disabled alternate color.
   *
   * @param disabledAlternateBaseColor the disabled alternate color
   */
  public void setDisabledAlternateBaseColor(Color disabledAlternateBaseColor) {
    this.disabledAlternateBaseColor = disabledAlternateBaseColor;
    hashCode = 0;
  }

  /**
   * Sets active text color.
   *
   * @param activeTextColor the active text color
   */
  public void setActiveTextColor(Color activeTextColor) {
    this.activeTextColor = activeTextColor;
    hashCode = 0;
  }

  /**
   * Sets inactive text color.
   *
   * @param inactiveTextColor the inactive text color
   */
  public void setInactiveTextColor(Color inactiveTextColor) {
    this.inactiveTextColor = inactiveTextColor;
    hashCode = 0;
  }

  /**
   * Sets disabled text color.
   *
   * @param disabledTextColor the disabled text color
   */
  public void setDisabledTextColor(Color disabledTextColor) {
    this.disabledTextColor = disabledTextColor;
    hashCode = 0;
  }

  /**
   * Sets active button color.
   *
   * @param activeButtonColor the active button color
   */
  public void setActiveButtonColor(Color activeButtonColor) {
    this.activeButtonColor = activeButtonColor;
    hashCode = 0;
  }

  /**
   * Sets inactive button color.
   *
   * @param inactiveButtonColor the inactive button color
   */
  public void setInactiveButtonColor(Color inactiveButtonColor) {
    this.inactiveButtonColor = inactiveButtonColor;
    hashCode = 0;
  }

  /**
   * Sets disabled button color.
   *
   * @param disabledButtonColor the disabled button color
   */
  public void setDisabledButtonColor(Color disabledButtonColor) {
    this.disabledButtonColor = disabledButtonColor;
    hashCode = 0;
  }

  /**
   * Sets active button text color.
   *
   * @param activeButtonTextColor the active button text color
   */
  public void setActiveButtonTextColor(Color activeButtonTextColor) {
    this.activeButtonTextColor = activeButtonTextColor;
    hashCode = 0;
  }

  /**
   * Sets inactive button text color.
   *
   * @param inactiveButtonTextColor the inactive button text color
   */
  public void setInactiveButtonTextColor(Color inactiveButtonTextColor) {
    this.inactiveButtonTextColor = inactiveButtonTextColor;
    hashCode = 0;
  }

  /**
   * Sets disabled button text color.
   *
   * @param disabledButtonTextColor the disabled button text color
   */
  public void setDisabledButtonTextColor(Color disabledButtonTextColor) {
    this.disabledButtonTextColor = disabledButtonTextColor;
    hashCode = 0;
  }

  /**
   * Sets active bright text color.
   *
   * @param activeBrightTextColor the active bright text color
   */
  public void setActiveBrightTextColor(Color activeBrightTextColor) {
    this.activeBrightTextColor = activeBrightTextColor;
    hashCode = 0;
  }

  /**
   * Sets inactive bright text color.
   *
   * @param inactiveBrightTextColor the inactive bright text color
   */
  public void setInactiveBrightTextColor(Color inactiveBrightTextColor) {
    this.inactiveBrightTextColor = inactiveBrightTextColor;
    hashCode = 0;
  }

  /**
   * Sets disabled bright text color.
   *
   * @param disabledBrightTextColor the disabled bright text color
   */
  public void setDisabledBrightTextColor(Color disabledBrightTextColor) {
    this.disabledBrightTextColor = disabledBrightTextColor;
    hashCode = 0;
  }

  /**
   * Sets active light color.
   *
   * @param activeLightColor the active light color
   */
  public void setActiveLightColor(Color activeLightColor) {
    this.activeLightColor = activeLightColor;
    hashCode = 0;
  }

  /**
   * Sets inactive light color.
   *
   * @param inactiveLightColor the inactive light color
   */
  public void setInactiveLightColor(Color inactiveLightColor) {
    this.inactiveLightColor = inactiveLightColor;
    hashCode = 0;
  }

  /**
   * Sets disabled light color.
   *
   * @param disabledLightColor the disabled light color
   */
  public void setDisabledLightColor(Color disabledLightColor) {
    this.disabledLightColor = disabledLightColor;
    hashCode = 0;
  }

  /**
   * Sets active midlight color.
   *
   * @param activeMidlightColor the active midlight color
   */
  public void setActiveMidlightColor(Color activeMidlightColor) {
    this.activeMidlightColor = activeMidlightColor;
    hashCode = 0;
  }

  /**
   * Sets inactive midlight color.
   *
   * @param inactiveMidlightColor the inactive midlight color
   */
  public void setInactiveMidlightColor(Color inactiveMidlightColor) {
    this.inactiveMidlightColor = inactiveMidlightColor;
    hashCode = 0;
  }

  /**
   * Sets disabled midlight color.
   *
   * @param disabledMidlightColor the disabled midlight color
   */
  public void setDisabledMidlightColor(Color disabledMidlightColor) {
    this.disabledMidlightColor = disabledMidlightColor;
    hashCode = 0;
  }

  /**
   * Sets active dark color.
   *
   * @param activeDarkColor the active dark color
   */
  public void setActiveDarkColor(Color activeDarkColor) {
    this.activeDarkColor = activeDarkColor;
    hashCode = 0;
  }

  /**
   * Sets inactive dark color.
   *
   * @param inactiveDarkColor the inactive dark color
   */
  public void setInactiveDarkColor(Color inactiveDarkColor) {
    this.inactiveDarkColor = inactiveDarkColor;
    hashCode = 0;
  }

  /**
   * Sets disabled dark color.
   *
   * @param disabledDarkColor the disabled dark color
   */
  public void setDisabledDarkColor(Color disabledDarkColor) {
    this.disabledDarkColor = disabledDarkColor;
    hashCode = 0;
  }

  /**
   * Sets active mid color.
   *
   * @param activeMidColor the active mid color
   */
  public void setActiveMidColor(Color activeMidColor) {
    this.activeMidColor = activeMidColor;
    hashCode = 0;
  }

  /**
   * Sets inactive mid color.
   *
   * @param inactiveMidColor the inactive mid color
   */
  public void setInactiveMidColor(Color inactiveMidColor) {
    this.inactiveMidColor = inactiveMidColor;
    hashCode = 0;
  }

  /**
   * Sets disabled mid color.
   *
   * @param disabledMidColor the disabled mid color
   */
  public void setDisabledMidColor(Color disabledMidColor) {
    this.disabledMidColor = disabledMidColor;
    hashCode = 0;
  }

  /**
   * Sets active shadow color.
   *
   * @param activeShadowColor the active shadow color
   */
  public void setActiveShadowColor(Color activeShadowColor) {
    this.activeShadowColor = activeShadowColor;
    hashCode = 0;
  }

  /**
   * Sets inactive shadow color.
   *
   * @param inactiveShadowColor the inactive shadow color
   */
  public void setInactiveShadowColor(Color inactiveShadowColor) {
    this.inactiveShadowColor = inactiveShadowColor;
    hashCode = 0;
  }

  /**
   * Sets disabled shadow color.
   *
   * @param disabledShadowColor the disabled shadow color
   */
  public void setDisabledShadowColor(Color disabledShadowColor) {
    this.disabledShadowColor = disabledShadowColor;
    hashCode = 0;
  }

  /**
   * Sets active highlight color.
   *
   * @param activeHighlightColor the active highlight color
   */
  public void setActiveHighlightColor(Color activeHighlightColor) {
    this.activeHighlightColor = activeHighlightColor;
    hashCode = 0;
  }

  /**
   * Sets inactive highlight color.
   *
   * @param inactiveHighlightColor the inactive highlight color
   */
  public void setInactiveHighlightColor(Color inactiveHighlightColor) {
    this.inactiveHighlightColor = inactiveHighlightColor;
    hashCode = 0;
  }

  /**
   * Sets disabled highlight color.
   *
   * @param disabledHighlightColor the disabled highlight color
   */
  public void setDisabledHighlightColor(Color disabledHighlightColor) {
    this.disabledHighlightColor = disabledHighlightColor;
    hashCode = 0;
  }

  /**
   * Sets active highlighted text color.
   *
   * @param activeHighlightedTextColor the active highlighted text color
   */
  public void setActiveHighlightedTextColor(Color activeHighlightedTextColor) {
    this.activeHighlightedTextColor = activeHighlightedTextColor;
    hashCode = 0;
  }

  /**
   * Sets inactive highlighted text color.
   *
   * @param inactiveHighlightedTextColor the inactive highlighted text color
   */
  public void setInactiveHighlightedTextColor(
                                          Color inactiveHighlightedTextColor) {
    this.inactiveHighlightedTextColor = inactiveHighlightedTextColor;
    hashCode = 0;
  }

  /**
   * Sets disabled highlighted text color.
   *
   * @param disabledHighlightedTextColor the disabled highlighted text color
   */
  public void setDisabledHighlightedTextColor(
                                          Color disabledHighlightedTextColor) {
    this.disabledHighlightedTextColor = disabledHighlightedTextColor;
    hashCode = 0;
  }

  /**
   * Sets active link text color.
   *
   * @param activeLinkColor the active link color
   */
  public void setActiveLinkColor(Color activeLinkColor) {
    this.activeLinkColor = activeLinkColor;
    hashCode = 0;
  }

  /**
   * Sets inactive link text color.
   *
   * @param inactiveLinkColor the inactive link color
   */
  public void setInactiveLinkColor(Color inactiveLinkColor) {
    this.inactiveLinkColor = inactiveLinkColor;
    hashCode = 0;
  }

  /**
   * Sets disabled link text color.
   *
   * @param disabledLinkColor the disabled link color
   */
  public void setDisabledLinkColor(Color disabledLinkColor) {
    this.disabledLinkColor = disabledLinkColor;
    hashCode = 0;
  }

  /**
   * Sets active link visited text color.
   *
   * @param activeLinkVisitedColor the active link visited color
   */
  public void setActiveLinkVisitedColor(Color activeLinkVisitedColor) {
    this.activeLinkVisitedColor = activeLinkVisitedColor;
    hashCode = 0;
  }

  /**
   * Sets inactive link visited text color.
   *
   * @param inactiveLinkVisitedColor the inactive link visited color
   */
  public void setInactiveLinkVisitedColor(Color inactiveLinkVisitedColor) {
    this.inactiveLinkVisitedColor = inactiveLinkVisitedColor;
    hashCode = 0;
  }

  /**
   * Sets disabled link visited text color.
   *
   * @param disabledLinkVisitedColor the disabled link visited color
   */
  public void setDisabledLinkVisitedColor(Color disabledLinkVisitedColor) {
    this.disabledLinkVisitedColor = disabledLinkVisitedColor;
    hashCode = 0;
  }

// Overridden Methods. ---------------------------------------------------------

  /**
   * {@inheritDoc}
   */
  public int hashCode() { // NOPMD
    if (hashCode == 0) {
      hashCode = super.hashCode();
    }
    return hashCode; // NOFB
  }

  /**
   * {@inheritDoc}
   */
  public String getName() {
    return name;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveBackgroundColor() {
    return activeBackgroundColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveBackgroundColor() {
    return inactiveBackgroundColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledBackgroundColor() {
    return disabledBackgroundColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveForegroundColor() {
    return activeForegroundColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveForegroundColor() {
    return inactiveForegroundColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledForegroundColor() {
    return disabledForegroundColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveBaseColor() {
    return activeBaseColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveBaseColor() {
    return inactiveBaseColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledBaseColor() {
    return disabledBaseColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveAlternateBaseColor() {
    return activeAlternateBaseColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveAlternateBaseColor() {
    return inactiveAlternateBaseColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledAlternateBaseColor() {
    return disabledAlternateBaseColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveTextColor() {
    return activeTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveTextColor() {
    return inactiveTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledTextColor() {
    return disabledTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveButtonColor() {
    return activeButtonColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveButtonColor() {
    return inactiveButtonColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledButtonColor() {
    return disabledButtonColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveButtonTextColor() {
    return activeButtonTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveButtonTextColor() {
    return inactiveButtonTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledButtonTextColor() {
    return disabledButtonTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveBrightTextColor() {
    return activeBrightTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveBrightTextColor() {
    return inactiveBrightTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledBrightTextColor() {
    return disabledBrightTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveLightColor() {
    return activeLightColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveLightColor() {
    return inactiveLightColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledLightColor() {
    return disabledLightColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveMidlightColor() {
    return activeMidlightColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveMidlightColor() {
    return inactiveMidlightColor;
  }

  /**
  * {@inheritDoc}
  */
 public Color getDisabledMidlightColor() {
    return disabledMidlightColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveDarkColor() {
    return activeDarkColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveDarkColor() {
    return inactiveDarkColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledDarkColor() {
    return disabledDarkColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveMidColor() {
    return activeMidColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveMidColor() {
    return inactiveMidColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledMidColor() {
    return disabledMidColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveShadowColor() {
    return activeShadowColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveShadowColor() {
    return inactiveShadowColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledShadowColor() {
    return disabledShadowColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveHighlightColor() {
    return activeHighlightColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveHighlightColor() {
    return inactiveHighlightColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledHighlightColor() {
    return disabledHighlightColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveHighlightedTextColor() {
    return activeHighlightedTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveHighlightedTextColor() {
    return inactiveHighlightedTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledHighlightedTextColor() {
    return disabledHighlightedTextColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveLinkColor() {
    return activeLinkColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveLinkColor() {
    return inactiveLinkColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledLinkColor() {
    return disabledLinkColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getActiveLinkVisitedColor() {
    return activeLinkVisitedColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getInactiveLinkVisitedColor() {
    return inactiveLinkVisitedColor;
  }

  /**
   * {@inheritDoc}
   */
  public Color getDisabledLinkVisitedColor() {
    return disabledLinkVisitedColor;
  }

// Package-Private Native Methods. ---------------------------------------------

  native void _fillPalette(String name);

  native void _fillPaletteFromColor(int argb);

}
